package com.cande.loki.exercise.algorithm;

/**
 * @auther ROCK CODER
 * @DATE 2023/2/2 10:45
 * @Description 递归实现1到100累加
 */
public class DiGuiAdd {
    public static void main(String[] args) {
        System.out.println( add(100));
    }
    public static Integer add(Integer num){
        if (num==1){
            return 1;
        }else {
            return num + add(num - 1);
        }
    }
}
